﻿namespace NumericalSolution {
  class Convection1DLW : Convection1D {

    public override double[] Next() {
      base.Age();

      p_next_u[0] = 0.0;
      for (int i = 1; i < p_numberOfNodes - 1; i++) {
        double nu = (a(i * p_deltaX, p_currentTime) * p_deltaTime) / p_deltaX;
        p_next_u[i] = 0.5 * nu * (1 + nu) * p_current_u[i - 1]
                    + (1 - nu * nu) * p_current_u[i]
                    - 0.5 * nu * (1 - nu) * p_current_u[i + 1];

      }
      p_next_u[p_numberOfNodes - 1] = 0.0;
      p_currentTime += p_deltaTime;
      return p_next_u;
    }

  }
}
